; (function (win) {
  function Ue4func() {

  }

  // 原型链
  Ue4func.prototype = {
    init(callback) {
      load();

      var grabStyle = 'cursor: default; cursor: -moz-default; cursor: -webkit-default';
      styleAdditional = grabStyle;
      inputOptions.controlScheme = ControlSchemeType.HoveringMouse;
      inputOptions.fakeMouseWithTouches = true;

      addResponseEventListener("res", (data) => {
        let obj = JSON.parse(data);
        callback(obj);
        console.log(obj, 'res>>>>>>');
      });
    },

    // 变换为移动
    toggleTranslate() {
      let obj = { actionname: "EWI_Translation", data: {} };
      emitUIInteraction(obj);
    },

    // 变换为旋转
    toggleRotate() {
      let obj = { actionname: "EWI_Rotation", data: {} };
      emitUIInteraction(obj);
    },

    // 变换为缩放
    toggleScale() {
      let obj = { actionname: "EWI_Scale", data: {} };
      emitUIInteraction(obj);
    },

    // 保存所有
    saveAll() {
      let obj = { actionname: "EWI_SaveGame", data: {} };
      emitUIInteraction(obj);
    },

    // 获取选中模型属性信息
    getActorData() {
      let obj = { actionname: "EWI_GetActorData", data: { NameInLevel: currentPoint.Data.NameInLevel } };

      currentPoint && emitUIInteraction(obj);
    },

    // 更改选中的actor信息
    setActorData(data) {
      let obj = { actionname: "EWI_PointChange", data };
      emitUIInteraction(obj);
    },

    // 获取某类的所有actor
    getActorByClassName(className) {
      let obj = {
        actionname: "EWI_GetActorsByClassName", data: {
          ClassName: className
        }
      };

      emitUIInteraction(obj);
    },

    // 获取场景中所有可编辑actor
    getEditActor() {
      let obj = { actionname: "EWI_GetAllLevelActor" };

      emitUIInteraction(obj);
    },


    //激活打点模式(模型)
    startModelPoint(type, name) {
      let obj = {
        actionname: "EWI_ActiveDaDianMode", data: {
          Mac: type,
          FileName: name
        }
      };

      emitUIInteraction(obj);
    },

    // 激活打点模式(交互标点)
    startActivePoint(type, val) {
      let obj;

      switch (type) {
        case 'point':

          obj = {
            actionname: "EWI_ActiveDaDianMode",
            data: {
              Mac: val.mac ? val.mac : 'CustomPoint_NoSameName',
              UnHoverImgUrl: 'http://192.168.60.73:27532' + val.jhtbIcon,
              HoverImgUrl: 'http://192.168.60.73:27532' + val.jhtbIcon,
            }
          };
          break;
        case 'road':
          obj = {
            actionname: "EWI_ActiveHuaXian",
            data: {
              Mac: 'BaseSpline_NoSameName'
            }
          };
          break;
        case 'light':
          obj = {
            actionname: "EWI_ActiveDaDianMode",
            data: {
              Mac: 'BaseLight_NoSameName'
            }
          };
          break;
      }

      emitUIInteraction(obj);
    },

    //激活画线模式，鼠标右键可停止画线
    DrawLines(type) {
      let obj = { actionname: "EWI_ActiveHuaXian", data: { Mac: type } };

      emitUIInteraction(obj);
    },


    // 结束打点模式
    endPoint() {
      let obj = { actionname: "EWI_DeactiveDaDianMode", data: {} };

      emitUIInteraction(obj);
    },

    // 根据LevelName移动到某个模型
    moveToActor(name) {
      let obj = {
        actionname: "EWI_SelectActorFromName", data: {
          NameInLevel: name
        }
      };

      emitUIInteraction(obj);
    },

    // 关闭项目
    closeProject() {
      let obj = { actionname: "EWI_CloseProject", data: {} };

      emitUIInteraction(obj);
    },


    //根据名字删除actor
    deleteActor(name) {
      let obj = { actionname: "EWI_DeleteActor", data: { NameInLevel: name } };

      emitUIInteraction(obj);
    },

    //设置坐标的显示隐藏
    AixVisible(status) {
      let obj = { actionname: "EWI_SetAixVis", data: { Visible: status } };

      emitUIInteraction(obj);
    },

    //根据名字设置actor的显示隐藏
    ForNameAixVisible(name, status) {
      let obj = { actionname: "EWI_SetActorVis", data: { NameInLevel: name, Visible: status } };

      emitUIInteraction(obj);
    },

    // 刷新场景
    refreshScene() {
      let obj = {
        actionname: "EWI_Refresh", data: {}
      };

      emitUIInteraction(obj);
    },

    // 点位复制
    copyActor() {
      let obj = {
        actionname: "EWI_CopyActor", data: {}
      };

      emitUIInteraction(obj);
    },

    // 悬浮物坠地
    attachGround() {
      let obj = {
        actionname: "EWI_AttachGround", data: {}
      };

      emitUIInteraction(obj);
    },

    // 设置坐标轴显示隐藏
    setAixVis(val) {
      let obj = {
        actionname: "EWI_SetAixVis", data: {
          Visible: val
        }
      };

      emitUIInteraction(obj);
    }
  }

  win.$ue4 = new Ue4func();
})(window);